<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="tong.li&#39;s blog">
  <meta name="keyword" content="彤哥哥博客，95后技术爱好者,现就职于同程旅行/同程艺龙上海分公司，专注于互联网技术分享的平台。">
  
    <link rel="shortcut icon" href="/css/images/icon.png">
  
  <title>
    
      巧用Gitee+PicGo+Typora搭建免费图床 | 彤哥哥的博客
    
  </title>
  <link href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="https://cdn.staticfile.org/highlight.js/9.12.0/styles/tomorrow-night.min.css" rel="stylesheet">
  
<link rel="stylesheet" href="/css/style.css">

  
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.js"></script>
  
    
<script src="/js/qrious.js"></script>

  
  
  
  
    <!-- MathJax support START -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="https://cdn.staticfile.org/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <!-- MathJax support END -->
  


  
  
    
<script src="/js/local-search.js"></script>


<meta name="generator" content="Hexo 5.4.2"></head>
<div class="wechat-share">
  <img src="/css/images/logo.png" />
</div>
  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/">
      <div class="logo"></div>
      <span>彤哥哥的博客</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/" class="item-link">主页</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/series/" class="item-link">分类</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/tags/" class="item-link">标签</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/archives/" class="item-link">归档</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/project/" class="item-link">项目</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/about/" class="item-link">关于</a>
          
        </li>
      
      
        <li class="menu-item menu-item-search right-list">
    <a role="button" class="popup-trigger">
        <i class="fa fa-search fa-fw"></i>
    </a>
</li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/" class="menu-link">主页</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/series/" class="menu-link">分类</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/tags/" class="menu-link">标签</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/archives/" class="menu-link">归档</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/project/" class="menu-link">项目</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/about/" class="menu-link">关于</a>
            
          </li>
        
      </ul>
    </div>
    
      <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
            <span class="search-icon">
                <i class="fa fa-search"></i>
            </span>
            <div class="search-input-container">
                <input autocomplete="off" autocapitalize="off"
                    placeholder="Please enter your keyword(s) to search." spellcheck="false"
                    type="search" class="search-input">
            </div>
            <span class="popup-btn-close">
                <i class="fa fa-times-circle"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>
    
  </div>
</header>

    <div id="article-banner">
  <h2>巧用Gitee+PicGo+Typora搭建免费图床</h2>
  <p class="post-date">2020-07-31</p>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><h1 id="1-前言"><a href="#1-前言" class="headerlink" title="1. 前言"></a>1. 前言</h1><p>最近在用七牛云进行存储文件时，我发现上传图片的会被压缩，图片分辨率压缩后会降低，将图片网络地址引入到博客中，图片内容辨识度也变得很低。</p>
<p>具体的图片被压缩原因是什么，再跟七牛云的客服和工程师进行短暂的<a target="_blank" rel="noopener" href="https://support.qiniu.com/tickets/221000">沟通</a>，了解到七牛云对象存储的一些限制：</p>
<ol>
<li>未绑定国内备案域名的对象存储空间,由于测试域名的限制，默认开启了忽略url参数设置。即用测试域名访问到的图片会被压缩。</li>
<li>已绑定国内备案域名的对象存储空间,可以在存储空间设置里关闭忽略url参数，即不压缩。</li>
<li>对于海外未备案域名,七牛CDN可提供在纯海外区域(不含中国大陆)的加速访问。图片也能关闭忽略url参数,但是只能海外网络访问,中国大陆不支持访问。</li>
</ol>
<p>当你写博时时，遇到以下类似问题而束手无策时，搭建免费图床可以帮助你解决：</p>
<ol>
<li>markdown插图流程繁琐：截图保存-&gt;图片上传到网络服务器-&gt;复制网络图片地址-&gt;插图到markdown。</li>
<li>阿里云、腾讯云、七牛云以及其他对象存储的服务提供商有限制，没钱或者懒得折腾，可以利用现有的免费资源来解决问题。</li>
<li>优化博客，对静态资源进行CDN加速，若hexo博客在github上托管，访问速度会很慢，将图片转移到国内开源仓库的码云是个不错的选择。</li>
</ol>
<h1 id="2-配置环境"><a href="#2-配置环境" class="headerlink" title="2. 配置环境"></a>2. 配置环境</h1><h2 id="2-1-Gitee仓库配置"><a href="#2-1-Gitee仓库配置" class="headerlink" title="2.1 Gitee仓库配置"></a>2.1 Gitee仓库配置</h2><ol>
<li><p>创建仓库</p>
<p><img src="https://ltyeamin.github.io/imgs/2020/07/20200731115026.png"></p>
<blockquote>
<p>注意: 作为图床的仓库，一定不能勾掉管理界面的<code>在线编辑 是否允许仓库文件在线编辑</code>选 项，否则使用PicGo管理的时候会导致操作被403 Forbidden。</p>
</blockquote>
</li>
</ol>
<ol start="2">
<li><p>创建<a target="_blank" rel="noopener" href="https://gitee.com/profile/personal_access_tokens/new">私人令牌</a>，使<code>PicGo</code>对仓库具有访问并更新的权限。</p>
<p><img src="https://ltyeamin.github.io/imgs/2020/07/20200731115734.png" alt="image-20200731115734387"></p>
<blockquote>
<p>注意: 私有令牌一旦提交，会以弹窗的形式告诉你token，请尽快复制，关闭窗口后无法找回，必须重新生成。</p>
</blockquote>
</li>
</ol>
<h2 id="2-2-PicGo图床工具配置"><a href="#2-2-PicGo图床工具配置" class="headerlink" title="2.2 PicGo图床工具配置"></a>2.2 PicGo图床工具配置</h2><ol>
<li><p><a target="_blank" rel="noopener" href="https://github.com/Molunerfinn/PicGo/releases">下载</a>并安装PicGo软件</p>
</li>
<li><p>检查是否有node与npm环境，若没有，请先移步<a target="_blank" rel="noopener" href="http://www.baidu.com/link?url=55wdkUpdXP65DVPaFk6pnHTbbBdhcO1YMyaTfY1gd0C"><strong>node</strong>js官网</a>安装node环境，确保node和npm环境没问题。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">C:\Users\LT&gt;node -v</span><br><span class="line">v12.13.0</span><br><span class="line">C:\Users\LT&gt;npm -v</span><br><span class="line">6.12.0</span><br></pre></td></tr></table></figure></li>
<li><p>安装PicGo gitee-uploader插件。</p>
<p><img src="https://ltyeamin.github.io/imgs/2020/07/20200731113727.png" alt="image-20200731113727771"></p>
</li>
<li><p>插件配置。</p>
<p><img src="https://ltyeamin.github.io/imgs/2020/07/20200731114428.png" alt="image-20200731114428370"></p>
</li>
<li><p>复制一个图片到剪贴板，按Ctrl+Shift+P快捷键快速上传或者在左侧菜单上传区进行上传测试。</p>
<p><img src="https://ltyeamin.github.io/imgs/2020/07/20200731113617.png" alt="image-20200731113617587"></p>
</li>
</ol>
<h2 id="2-3-Markdown编辑器配置"><a href="#2-3-Markdown编辑器配置" class="headerlink" title="2.3 Markdown编辑器配置"></a>2.3 Markdown编辑器配置</h2><p>我这里使用<a target="_blank" rel="noopener" href="https://www.typora.io/">Typora</a>当作MarkDown编辑器。所以这里我只介绍Typora与PicGo的配合使用，若读者使用其他Markdown编辑器，请自行研究。</p>
<p>Typora与PicGo配合使用也很简单，只需要打开Typora文件-&gt;偏好设置-&gt;图形设置一下就可以。</p>
<p><img src="https://ltyeamin.github.io/imgs/2020/07/20200731121033.png" alt="image-20200731121033635"></p>
<p>至此我们就完成了Typora的设置，只要我们截图到粘贴板的图片，直接复制到Typora编辑器里，会默认上传到码云。</p>
<h1 id="3-参考资料"><a href="#3-参考资料" class="headerlink" title="3. 参考资料"></a>3. 参考资料</h1><ul>
<li><a target="_blank" rel="noopener" href="https://gitee.com/">码云</a></li>
<li><a target="_blank" rel="noopener" href="http://www.baidu.com/link?url=55wdkUpdXP65DVPaFk6pnHTbbBdhcO1YMyaTfY1gd0C"><strong>node</strong>js官网</a></li>
<li><a target="_blank" rel="noopener" href="https://github.com/Molunerfinn/PicGo">PicGo</a></li>
<li><a target="_blank" rel="noopener" href="https://www.typora.io/">Typora</a></li>
</ul>
</section>
    <!-- Tags START -->
    
      <div class="tags">
        <span>Tags:</span>
        
  <a href="/tags#实用工具及技巧" >
    <span class="tag-code">实用工具及技巧</span>
  </a>

      </div>
    
    <!-- Tags END -->
    <!-- NAV START -->
    
  <div class="nav-container">
    <!-- reverse left and right to put prev and next in a more logic postition -->
    
      <a class="nav-left" href="/2020/07/29/%E3%80%90MySQL%E9%AB%98%E7%BA%A7%E5%AE%9E%E6%88%98%E3%80%91-%E7%B4%A2%E5%BC%95%E4%B8%8E%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E5%AD%A6%E4%B9%A0%E6%8C%87%E5%8D%97/">
        <span class="nav-arrow">← </span>
        
          【MySQL高级实战】-索引与存储引擎学习指南
        
      </a>
    
    
      <a class="nav-right" href="/2020/08/01/%E3%80%90%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95%E3%80%91%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95%E5%88%9D%E8%AF%86/">
        
          【数据结构与算法】数据结构与算法初识
        
        <span class="nav-arrow"> →</span>
      </a>
    
  </div>

    <!-- NAV END -->
    <!-- 打赏 START -->
    
      <div class="money-like">
        <div class="reward-btn">
          赏
          <span class="money-code">
            <span class="alipay-code">
              <div class="code-image"></div>
              <b>使用支付宝打赏</b>
            </span>
            <span class="wechat-code">
              <div class="code-image"></div>
              <b>使用微信打赏</b>
            </span>
          </span>
        </div>
        <p class="notice">若你觉得我的文章对你有帮助，欢迎点击上方按钮对我打赏</p>
      </div>
    
    <!-- 打赏 END -->
    <!-- 二维码 START -->
    
      <div class="qrcode">
        <canvas id="share-qrcode"></canvas>
        <p class="notice">扫描二维码，分享此文章</p>
      </div>
    
    <!-- 二维码 END -->
    
      <!-- Utterances START -->
      <div id="utterances"></div>
      <script src="https://utteranc.es/client.js"
        repo="ltyeamin/blogtalks"
        issue-term="pathname"
        theme="github-light"
        crossorigin="anonymous"
        async></script>    
      <!-- Utterances END -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
    <aside class="catalog-container">
  <div class="toc-main">
    <strong class="toc-title">Catalog</strong>
    
      <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#1-%E5%89%8D%E8%A8%80"><span class="toc-nav-text">1. 前言</span></a></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#2-%E9%85%8D%E7%BD%AE%E7%8E%AF%E5%A2%83"><span class="toc-nav-text">2. 配置环境</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#2-1-Gitee%E4%BB%93%E5%BA%93%E9%85%8D%E7%BD%AE"><span class="toc-nav-text">2.1 Gitee仓库配置</span></a></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#2-2-PicGo%E5%9B%BE%E5%BA%8A%E5%B7%A5%E5%85%B7%E9%85%8D%E7%BD%AE"><span class="toc-nav-text">2.2 PicGo图床工具配置</span></a></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#2-3-Markdown%E7%BC%96%E8%BE%91%E5%99%A8%E9%85%8D%E7%BD%AE"><span class="toc-nav-text">2.3 Markdown编辑器配置</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-1"><a class="toc-nav-link" href="#3-%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99"><span class="toc-nav-text">3. 参考资料</span></a></li></ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'http://example.com/2020/07/31/巧用Gitee+PicGo+Typora搭建免费图床/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

    // error image
    $(".markdown-content img").on('error', function() {
      $(this).attr('src', '/css/images/error_icon.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function() {
      var src = $(this).attr('src')
      if (src !== '/css/images/error_icon.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()

        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="'+ src +'" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function() {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })
  })();
</script>


  <script>
    var qr = new QRious({
      element: document.getElementById('share-qrcode'),
      value: document.location.href
    });
  </script>






    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
  <p class="copyright">
    &copy; 2024 | Proudly powered by <a href="https://hexo.io" target="_blank">Hexo</a>
    <br>
    Theme by <a target="_blank" rel="noopener" href="https://github.com/ltyeamin">tong.li</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("https://cdn.staticfile.org/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("https://cdn.staticfile.org/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      hljs.configure({useBR: true});
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>
<!-- Baidu Tongji -->



<script src='https://cdn.staticfile.org/mermaid/8.11.2/mermaid.min.js'></script>



<script src="/js/script.js"></script>


  </body>
</html>